package Io01;


import java.io.*;
import java.util.Properties;


public class CopyClass {
    public CopyClass(String a,String b) {
        BufferedInputStream bis = null;
        BufferedOutputStream bos = null;
        try {
            bos=new BufferedOutputStream(new FileOutputStream(b));
            bis=new BufferedInputStream(new FileInputStream(a));
            byte []bytes=new byte[1024];
            int index=0;
            if(bos==null) {
                while ((index = bis.read(bytes)) != -1) {
                    bos.write(bytes, 0, index);
                }
            }
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }finally {
            if (bis!=null){
                try {
                    bis.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            if(bos!=null){
                try {
                    bos.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }

    public static void main(String[] args) {

      CopyClass  copyClass = new CopyClass("C:\\xiaoxiao01\\oLd.txt","C:\\xiaoxiao01\\old2.txt");
    }
}
